#include <stdio.h>
#include <unistd.h>
int main()
{
    printf("process is running··\n");
    //使用自定义的环境变量
    //char* const _env[]={(char*)"MYENV=12345",NULL};
    //execle("./mybin","mybin",NULL,_env);
    
    //使用系统的环境变量
    //extern char** environ;
    //execle("./mybin","mybin",NULL,environ);//系统环境变量不传，进程也能获取
    
    //使用putenv将自己的环境变量导入到environ指向的环境变量表中
    extern char** environ;
    char* const _env[]={(char*)"MYENV=12345",NULL};
    putenv((char*)"MYENV=654321");
    execle("./mybin","mybin",NULL,environ);
    printf("process is running··\n");
    return 0;
}
